<?php

require_once 'InputValidator.php';

class NumberValidator implements InputValidator{

    private $lb = 0;
    private $ub = null;

    public function __construct($lb = 0, $ub = null){
        $this->lb = $lb;
        $this->ub = $ub;
    }

    public function validate($input){
        if(!is_numeric($input))return false;
        if($lb != null && $input < $lb)return false;
        if($ub != null && $input > $ub)return false;
        return true;
    }

}
?>
